clear all
set more off
tempfile ubigeo temp

** DATA
use mergedp, clear
*keep if voted != .

local listaU todoAT todoA todoT
local listaC todoATc todoAc todoTc

recode todoAT (0 = .), gen(todoATc)
recode todoA (0 = .), gen(todoAc)
recode todoT (0 = .), gen(todoTc)

label var todoAT "Overall"
label var todoA "Government"
label var todoT "Terrorists"

label var todoATc "Overall"
label var todoAc "Government"
label var todoTc "Terrorists"

 
foreach var of varlist `listaU' `listaC' {
	global name_`var' : var label `var'

	sum `var' 
	glo m_`var' : di %12.3fc r(mean)
	glo sd_`var' : di %12.3fc r(sd)
	glo n_`var' : di %12.0fc r(N)
	glo min_`var' : di %12.0fc r(min)
	glo max_`var' : di %12.0fc r(max)
}

texdoc init Table_3.tex , replace
tex \begin{table}[h]
tex \caption{Years of exposure to violence}
tex \label{tab:statsX}
tex \begin{center}
tex \resizebox{11cm}{!}{
	tex \begin{tabular}{lccccccccccccccccccccccccccccccccccccccc} \hline \hline
    tex \\
	tex 					&& N & Mean & Standard  & Min &  Max   \\					
	tex 					&&   &      & deviation &     &          \\					
	tex \\
	tex \hline
	tex \\
	tex & \multicolumn{4}{l}{\emph{a. Unconstrained sample}} \\
 	foreach var of varlist `listaU'  {
     tex  \quad ${name_`var'}   & &  ${n_`var'} & ${m_`var'}  &  ${sd_`var'} &  ${min_`var'} & ${max_`var'}  \\
	}
	tex \\
	tex & \multicolumn{4}{l}{\emph{b. Consrained sample}} \\
 	foreach var of varlist `listaC'  {
     tex  \quad ${name_`var'}   & &  ${n_`var'} & ${m_`var'} &  ${sd_`var'} &  ${min_`var'} & ${max_`var'}  \\
	}
	tex \\
	tex \\ \hline \hline
    tex \end{tabular}}
tex \end{center}
tex \end{table}
